﻿@model eShop.Web.Models.OrderListModel
@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>我的订单-@{@WorkContext.ShopConfig.SiteTitle}</title>
    @Html.Raw(WorkContext.ShopConfig.SEOKeyword)
    @Html.Raw(WorkContext.ShopConfig.SEODescription)
    <link href="@{@WorkContext.CSSCDN}/themes/default/css/base.css" rel="stylesheet" type="text/css" />
    <link href="@{@WorkContext.CSSCDN}/themes/default/css/ucenter.css" rel="stylesheet" type="text/css" />
    <script src="@{@WorkContext.ScriptCDN}/scripts/jquery.js" type="text/javascript"></script>
    <script src="@{@WorkContext.ScriptCDN}/scripts/common.js" type="text/javascript"></script>
    <script src="@{@WorkContext.ScriptCDN}/scripts/ucenter.order.js" type="text/javascript"></script>
    <script type="text/javascript">
        uid = @WorkContext.Uid;
        isGuestSC = @WorkContext.ShopConfig.IsGuestSC;
        scSubmitType = @WorkContext.ShopConfig.SCSubmitType;
    </script>
</head>

<body>
@Html.Partial("_header")

<div class="bigBox" id="member">
<div class="box">
@Html.Partial("_menu")
<div id="memberR" style=" padding-bottom:0px;">
<h2 id="memberRT">我的订单
@*<div class="searchList"><select>
  <option>最近3个月</option>
  <option>今年内</option>
</select>
<select>
<option>全部状态</option>
<option>等待付款</option>
<option>等待自提</option>
<option>等待收货</option>
<option>已完成</option>
<option>已取消</option>
</select>
<input type="text" class="text" value="商品名称、商品编号、订单编号" /><a href="javascript:;" class="whiteBT">搜索</a>
<div class="clear"></div>
</div>*@
</h2>
<script type="text/javascript">
    //处理取消订单的反馈信息
    function cancelOrderResponse(data) {
        var result = eval("(" + data + ")");
        if (result.state == "success") {
            $("#orderState" + result.content).html("取消");
            $("#cancelOrderBut" + result.content).parent().html("<a href='" + document.getElementById("orderInfo" + result.content).href + "'>查看</a>");
            alert("取消成功");
        }
        else {
            alert(result.content);
        }
    }
</script>
<table width="100%" border="0" cellspacing="0" class="dingdan">
<thead>
  <tr>
    <th>订单信息</th>
    <th>收货人</th>
    <th>订单金额</th>
    <th>时间</th>
    <th>订单状态</th>
    <th>操作</th>
  </tr>
</thead>
<tbody>
  @foreach (DataRow row in Model.OrderList.Rows)
  {
      OrderState orderState = (OrderState)TypeHelper.ObjectToInt(row["orderstate"]);
  <tr class="dingdanTH"><td colspan="6">订单编号:<a target="_blank" href="@Url.Action("orderinfo", new RouteValueDictionary { { "oid", TypeHelper.ObjectToInt(row["oid"]) } })">@row["osn"]</a>&nbsp;&nbsp;&nbsp;&nbsp;@row["shipfriendname"]&nbsp;&nbsp;&nbsp;&nbsp;@row["payfriendname"]</td></tr>
  <tr>
    <td id="orderProductList">
        <div class="proList">
            @foreach (OrderProductInfo info in Orders.GetOrderProductList(TypeHelper.ObjectToInt(row["oid"]), Model.OrderProductList))
            {
            <a href="@Url.Action("product", "catalog", new RouteValueDictionary { { "pid", info.Pid } })"><img src="@{@WorkContext.ImageCDN}/upload/product/show/thumb60_60/@info.ShowImg" width="50" height="50" /></a>
            }
            <div class="clear"></div>
        </div>
    </td>
    <td>@row["consignee"]</td>
    <td>￥@row["surplusmoney"]</td>
    <td>@Html.Raw(TypeHelper.ObjectToDateTime(row["addtime"]).ToString("yyyy-MM-dd"))<br />@Html.Raw(TypeHelper.ObjectToDateTime(row["addtime"]).ToString("HH:mm:ss"))</td>
    <td id="orderState@{@row["oid"]}">
    @switch (orderState)
    {
        case OrderState.WaitPaying:
            @:等待付款
            break;
        case OrderState.Confirming:
            @:待确认
            break;
        case OrderState.Confirmed:
            @:已确认
            break;
        case OrderState.PreProducting:
            @:备货中
            break;
        case OrderState.Sended:
            @:已发货
            break;
        case OrderState.Completed:
            @:已完成
            break;
        case OrderState.Cancelled:
            @:取消
            break;
        case OrderState.Returned:
            @:退货
            break;
        case OrderState.Locked:
            @:锁定
            break;
        default:
            @:未知状态
            break;
    }
    </td>
    <td>
        <a href="@Url.Action("orderinfo", new RouteValueDictionary { { "oid", TypeHelper.ObjectToInt(row["oid"]) } })" id="orderInfo@{@row["oid"]}">查看 </a>
        @if (orderState == OrderState.WaitPaying && TypeHelper.ObjectToInt(row["paymode"]) == 1)
        {
        <a href="@Url.Action("payshow", "order", new RouteValueDictionary { { "oid", TypeHelper.ObjectToInt(row["oid"]) } })" id="payOrderBut@{@row["oid"]}">付款</a>
        }
        @if (orderState == OrderState.Completed && TypeHelper.ObjectToInt(row["isreview"]) == 0)
        {
        <a href="@Url.Action("revieworder", new RouteValueDictionary { { "oid", TypeHelper.ObjectToInt(row["oid"]) } })">评价</a>
        }
        @if (orderState == OrderState.WaitPaying || (orderState == OrderState.Confirming && TypeHelper.ObjectToInt(row["paymode"]) == 0))
        {
        <a href="javascript:cancelOrder(@row["oid"], 0)" id="cancelOrderBut@{@row["oid"]}">取消订单</a>
        }
    </td>
  </tr>
  }
</tbody>
</table>
@Html.WebPager(Model.PageModel).ShowSummary(false)
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>


@Html.Partial("_footer")
</body>
</html>

